<include file="nav:header"/>
<div class="container-fluid">
    <div class="row">
        <include file="Left:left-Common"/>
        <!-- right -->
        <div class="col-md-10 right">
            <div class="page-header" style="margin-right: 15px">
                <h3>{$page_title}</h3>
            </div>
            <form class="article_index" action="{:U('Article/batch_del')}" method="post">
                <div class="col-md-12">
                    <div class="index_top">
                        <div style="margin-left: 50px" class="btn-group pull-left " role="group" aria-label="Large button group">
                            <a href="{:U('Comment/index')}" type="button" class="btn btn-default">بارلىق ئىنكاسلار جەدىۋىلى</a>
                            <!--<a href="{:U('Article/add')}"  type="button" class="btn btn-default">ئۇچۇر قوشۇش</a>-->
                            <!--<button type="button" class="layui-btn pull-left" id="test2" style="margin-right: 10px;margin-top: -2px">-->
                                <!--<i class="layui-icon"></i>ئامبارغا رەسىم قوشۇش-->
                            <!--</button>-->
                        </div>
                        <!--<div class="col-md-2 pull-left"></div>-->
                        <!--<input value="{$pa}" onchange="_page(this)" style="width: 5%!important;text-align: center" type="text" class="form-control pull-left">-->
                        <!--<select onchange="serach(this.value) ;"  class="form-control input-sm serach pull-right" style="width: 20%;font-size: 15px;line-height: 34px;height: 34px">-->
                            <!--<option <if condition="$get_id eq 0">selected</if>  value="0">بارلىق</option>-->
                            <!--<foreach name="classify" item="c">-->
                                <!--<option <if condition="$c.id eq $get_id">selected</if>  value="{$c.id}"><if condition="$c['pid'] neq 0">{$c.lavel|_repeat} ┘─</if>{$c['name']}</option>-->
                            <!--</foreach>-->
                        <!--</select>-->
                        <!--<div class="form-group pull-right col-xs-2">-->
                            <!--<input type="text"  onKeyDown="return proc_kd(event);" onKeyPress="return addchar(this, event);" class="form-control" id="inputtext" value="{$search}" placeholder="ھالقىلىق سۆز">-->
                        <!--</div>-->
                        <!--<a class="btn btn-default pull-right" href="javascript:search_text();" role="button">ئىزدەش</a>-->
                    </div>
                    <!--所有分类-->
                    <table class="table table-bordered">
                        <thead>
                        <tr class="info">
                            <th width="50">ID</th>
                            <th width="70">ئۇچۇر ID</th>
                            <th width="400" style="text-align: center">ئەسەر تېمىسى</th>
                            <th width="400" style="text-align: center"> ئىنكاس مەزمۇنى</th>
                            <th style="text-align: center">IP ئادرېىسى</th>
                            <th style="text-align: center">ھالىتى</th>
                            <th style="text-align: center">يوللىغۇچى</th>
                            <th style="text-align: center">يوللىغان ۋاقتى</th>
                            <th style="text-align: center">مەشغۇلات</th>
                        </tr>
                        </thead>
                        <tbody>
                        <foreach name="comments" item="c">
                            <tr class="classifys active del_{$c.cid}">
                                <td>{$c['cid']}</td>
                                <td>{$c['newsid']}</td>
                                <td><a target="_blank" href="{$url}{$c.newsid}.shtml">{$c['title']|_substr}</a></td>
                                <td width="100" style="text-align: center">
                                    <textarea   onchange="_save(this,{$c['cid']})"  style="border: none;resize: vertical" class="form-control hidden-xs">{$c['content']}</textarea>
                                    <span class="visible-xs">{$c['content']}</span>
                                </td>
                                <td style="text-align: center">{$c.ip}</td>
                                <td style="text-align: center">
                                    <if condition="$c['status'] eq 1">
                                        <span style="margin-top: 6px;display: inline-block;"  onclick="_status(this,0,{$c['cid']})"  class="btn btn-success btn-xs kaiguan">تەستىقلاندى</span>
                                        <else/>
                                        <span style="margin-top: 6px;display: inline-block;" onclick="_status(this,1,{$c['cid']})" class="btn btn-danger btn-xs kaiguan">تەستىقلانمىغان</span>
                                    </if>
                                </td>
                                <td style="text-align: center">{$c['isim']}</td>
                                <td style="direction: ltr;text-align: center">{$c.intime|date="Y_m_d H:i",###}</td>
                                <td style="text-align: center">
                                    <a  style="margin-top: 6px;display: inline-block;" href="javascript:del({$c['cid']});" class="btn btn-danger btn-xs">ئۆچۈرۈش</a>
                                </td>
                            </tr>
                        </foreach>
                        </tbody>
                    </table>
                    <div style="margin-top: -10px" class="page_ye">
                        <dl>
                            <dd>تەستىقلانمىغان جەمئى {$comment_count} تال ئۇچۇر بار</dd>
                        </dl>
                        <!--分页-->
                        {$page}
                        <!--<ul class="quan_xuan">-->
                            <!--<li><input  onclick="CheckedAll()" class="layui-btn layui-btn-mini quan_xuan_btn1" type="button" value="ھەممىنى تاللاش"></li>-->
                            <!--<li><input class="layui-btn layui-btn-danger layui-btn-mini quan_xuan_btn2" type="submit" value="  تاللىغاننى ئۆچۈرۈش"></li>-->
                        <!--</ul>-->
                        <div style="clear:both;height: 2px;"></div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript">
    //分类排序
    function _save(obj,id) {
        var val=$(obj).val();
        $.ajax({
            type:"post",
            url:"{:U('Comment/save1')}",
            dataType:"json",
            data:{"content":val,"id":id},
            success:function (phpdata) {
                if(phpdata.status==1){
                    layer.alert(phpdata.message, {
                        title:"سېستىما ئەسكەرتىشى",
                        btn:"بىلدىم",
                        icon: 6,
                        skin: 'layer-ext-moon',
                        time:1300
                    });
                    setTimeout(ok,1300);
                    function ok() {
                        window.location=location;
                    }
                }else{
                    layer.alert(phpdata.message, {
                        title:"سېستىما ئەسكەرتىشى",
                        btn:"بىلدىم",
                        icon: 5,
                        skin: 'layer-ext-moon',
                        time:1000
                    });
                }
            }
        })
    }
    //删除分类
    function del(id) {
        layer.confirm('بۇ ئۇچۇرنى راستىنلا ئۆچۈرەمسىز ؟', {
            title:"سېستىما ئەسكەرتىشى",
            btn: ['ھەئە','ياق'] //按钮
        }, function(){
            $.ajax({
                type:"post",
                url:"{:U('Comment/del')}",
                dataType:"json",
                data:{"id":id},
                success:function (phpdata) {
                    if(phpdata.status==1){
                        layer.alert(phpdata.message, {
                            title:"سېستىما ئەسكەرتىشى",
                            btn:"بىلدىم",
                            icon: 6,
                            skin: 'layer-ext-moon',
                            time:800
                        });
                        setTimeout(ok,900);
                        function ok() {
                            $(".del_"+phpdata.id).fadeOut(500);
                        }
                    }else{
                        layer.alert(phpdata.message, {
                            title:"سېستىما ئەسكەرتىشى",
                            btn:"بىلدىم",
                            icon: 5,
                            skin: 'layer-ext-moon',
                            time:1000
                        });
                    }
                }
            })
        });

    }
    //分类状态
    function _status(obj,status,id) {
        if(status=='0'){
            $(obj).removeClass("btn-success");
            $(obj).addClass("btn-danger");
            $(obj).text("تەستىقلانمىغان")
        }else {
            $(obj).removeClass("btn-danger");
            $(obj).addClass("btn-success");
            $(obj).text("تەستىقلاندى")
        }
        $.ajax({
            type:"post",
            url:"{:U('Comment/sortStatus')}",
            dataType:"json",
            data:{"id":id,"status":status},
            success:function (phpdata) {
                if(phpdata.status==1){
                    layer.alert(phpdata.content, {
                        title:"سېستىما ئەسكەرتىشى",
                        btn:"بىلدىم",
                        icon: 6,
                        skin: 'layer-ext-moon',
                        time:1300
                    });
                    setTimeout(ok,1300);
                    function ok() {
                        window.location=location;
                    }
                }else{
                    layer.alert(phpdata.content, {
                        title:"سېستىما ئەسكەرتىشى",
                        btn:"بىلدىم",
                        icon: 5,
                        skin: 'layer-ext-moon',
                        time:1000
                    });
                }
            }
        })
    }
    $(function () {
        $('.classifys').hover(function () {
            $(this).addClass('info');
        },function () {
            $(".classifys").removeClass('info');
        })
    })
</script>
<include file="nav:footer"/>